/**
 * 下拉列表
 * @type {createApplication}
 */
var express = require('express');
var request = require('request');

var url = require('url');
var qstr = require("querystring");
var fs = require("fs");
var pro = require('../../property/cuspro');
var util = require('../../util/commonutil');
var router = express.Router();

router.get('/combTerminal', function(req, res){
    //var data=[{ id: 1, text: '黄' }, { id: 2, text: '白' }, { id: 3, text: '蓝' }, { id: 4, text: '黑' }];
    //res.json(data);
    //
    request({
        url: pro.serveraddr+'/baseTerminal/loadTerminal',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});
router.get('/combCarInfo', function(req, res){
    //var data=[{ id: 1, text: '黄' }, { id: 2, text: '白' }, { id: 3, text: '蓝' }, { id: 4, text: '黑' }];
    //res.json(data);
    //
    request({
        url: pro.serveraddr+'/baseCar/loadCars',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});
router.get('/combDriverInfo', function(req, res){

    request({
        url: pro.serveraddr+'/baseDriver/loadDriver',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});
router.get('/combWorkInfo', function(req, res){

    request({
        url: pro.serveraddr+'/baseWorkInfo/loadWorks',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});
router.get('/combWork', function(req, res){
    //var data=[{ id: 1, text: '黄' }, { id: 2, text: '白' }, { id: 3, text: '蓝' }, { id: 4, text: '黑' }];
    //res.json(data);
    //
    request({
        url: pro.serveraddr+'/baseWorkInfo/listComb',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});


router.get('/combCarType', function(req, res){

    request({
        url: pro.serveraddr+'/baseCarType/combCarTypelist',
        method: "GET",
    }, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            var data=JSON.parse(body);
            if(data.rows){
                res.json(data.rows);
            }else{
                res.json("");
            }

        }
    });

});

module.exports = router;
